//
//  JFStoreViewController.m
//  JiFengDaRen
//
//  Created by SH_iOS on 16/1/14.
//  Copyright © 2016年 SH_iOS. All rights reserved.
//
#import "JFStoreViewController.h"
#import "UserModel.h"
#import "SHQRCodeImageView.h"
#import "UIView+FLExtension.h"

@interface JFStoreViewController ()

@property (nonatomic, strong) SHQRCodeImageView * qrcodeImg;
@property (nonatomic, copy) NSString * shareUrlString;

@end

@implementation JFStoreViewController

- (void)viewWillAppear:(BOOL)animated{
    
    self.navigationController.navigationBar.hidden = YES;
    
}

#pragma mark - 设置状态栏字体颜色
- (UIStatusBarStyle)preferredStatusBarStyle{
    return  UIStatusBarStyleLightContent;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIImageView * shareImage = [UIImageView new];
    shareImage.image = [UIImage imageNamed:@"huike_share_bg"];
    [self.view addSubview:shareImage];
    
    [shareImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.bottom.equalTo(self.view);
    }];
    [self requstUserInfo];
    
}


#pragma mark - 获取用户资料
- (void)requstUserInfo{
    
    
    [SHUserCenterHttp requstUserInfoSuccess:^(UserModel *userModel) {
        _shareUrlString = [NSString stringWithFormat:@"%@%@%d",BASE_URL,Invitation,userModel._id];
        
        [self.qrcodeImg removeFromSuperview];
        self.qrcodeImg = [[SHQRCodeImageView alloc] initWithFrame:CGRectMake(0, 0, __I6Width(80), __I6Width(80))];
        self.qrcodeImg.centerY = __I6Height(207)+KNAVIGATIONBARHEIGHT-20;
        self.qrcodeImg.centerX = self.view.centerX;
        self.qrcodeImg.qrCodeSmallImage = @"code";
        self.qrcodeImg.qrCodeString = _shareUrlString;
        
        [self.view addSubview:self.qrcodeImg];
        
        UIImage *qrcodeImage = [self.qrcodeImg createNormalSmallImageERImageViewSmallImgSize:CGSizeMake(__I6Width(13), __I6Height(9)) samllImgWhiteBgSize:CGSizeMake(__I6Width(13), __I6Height(9))];
        self.qrcodeImg.image = qrcodeImage;
        
        
    } complection:^(id result) {
        
    } failure:^(id erro) {
        
    }];
    
}


@end
